<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=640px,user-scalable=no,target-densitydpi=device-dpi" />
		<link rel="stylesheet" href="../css/css.css" type="text/css" />
		<script type="text/javascript" src='../js/jquery.min.js'></script>
		<script type="text/javascript" src='../js/main_in.js'></script>
		<script type="text/javascript" src='../js/common.js'></script>
		<script type="text/javascript" src='../js/jquery.qrcode.min.js'></script>
		<title>我的信息</title>
		<script>
			var uid = window.localStorage["uid"];
			var name = window.localStorage["name"];
			var lgname = window.localStorage["lgname"];
			var RecommendBy = window.localStorage["RecommendBy"];
			
			$(function(){
				var appid='wx672f46da1d03136a';
				var rediret_url='http%3A%2F%2Fwx.unair.cn%2Fregister_h.php';
				$("#getcode").html(RecommendBy);
				$("#sharehref").val("http://insure.unair.cn/register_h.php?qrcode=" + RecommendBy)
				$("#user_name").val(name);
				$("#user_phone").val(lgname);
				$("#qrcode").qrcode("https://open.weixin.qq.com/connect/oauth2/authorize?appid="+appid+"&redirect_uri="+rediret_url+"&response_type=code&scope=snsapi_userinfo&state="+RecommendBy+"#wechat_redirect");
				$("#qrcode").children().css("width","80px");
				$("#qrcode").children().css("height","80px");
				$("#qrcode").children().css("margin-top","10px");
				$("#qrcode").children().click(function(){
					clicked("./bgcode.html");
				});
				
				
			})
			
			
			
			function exit(){
				localStorage.setItem("loginname",'');
                localStorage.setItem("password",'');
                localStorage.setItem("lgname", '');
                localStorage.setItem("uid", '');
                localStorage.setItem("name", '');
                localStorage.setItem("RecommendBy", '');
                jump_login();
			}
			
			function jump_login(){
				clicked("../user/login.html");
			}
			
			//////////////////分享///////////////
var shares=null;
// H5 plus事件处理
function plusReady(){
	updateSerivces();
}
if(window.plus){
	plusReady();
}else{
	document.addEventListener('plusready', plusReady, false);
}
/**
 * 更新分享服务
 */
function updateSerivces(){
	plus.share.getServices(function(s){
		shares={};
		for(var i in s){
			var t=s[i];
			shares[t.id]=t;
		}
	}, function(e){
//		outSet('获取分享服务列表失败：'+e.message);
	});
}

// 分析链接
function shareHref(){
	var shareBts=[];
	// 更新分享列表
	var ss=shares['weixin'];
	ss&&ss.nativeClient&&(shareBts.push({title:'微信朋友圈',s:ss,x:'WXSceneTimeline'}),
	shareBts.push({title:'微信好友',s:ss,x:'WXSceneSession'}));
	ss=shares['qq'];
	ss&&ss.nativeClient&&shareBts.push({title:'QQ',s:ss});
	// 弹出分享列表
	shareBts.length>0?plus.nativeUI.actionSheet({title:'分享链接',cancel:'取消',buttons:shareBts},function(e){
		(e.index>0)&&shareAction(shareBts[e.index-1],true);
	}):plus.nativeUI.alert('当前环境无法支持分享链接操作!');
}

/**
   * 分享操作
   * @param {JSON} sb 分享操作对象s.s为分享通道对象(plus.share.ShareService)
   * @param {Boolean} bh 是否分享链接
   */
function shareAction(sb,bh) {
	if(!sb||!sb.s){
		return;
	}
	var msg={content:sharecontent.value,extra:{scene:sb.x}};
	if(bh){
		msg.href=sharehref.value;
		if(sharehrefTitle&&sharehrefTitle.value!=''){
			msg.title=sharehrefTitle.value;
		}
		if(sharehrefDes&&sharehrefDes.value!=''){
			msg.content=sharehrefDes.value;
		}
		msg.thumbs=['_www/logo.png'];
		msg.pictures=['_www/logo.png'];
	}else{
		if(pic&&pic.realUrl){
			msg.pictures=[pic.realUrl];
		}
	}
	// 发送分享
	if(sb.s.authenticated){
//		alert('---已授权---');
		shareMessage(msg, sb.s);
	}else{
//		alert('---未授权---');
		sb.s.authorize(function(){
			shareMessage(msg,sb.s);
		}, function(e){
			alert('认证授权失败：'+e.code+' - '+e.message);
		});
	}
}
/**
   * 发送分享消息
   * @param {JSON} msg
   * @param {plus.share.ShareService}
   */
function shareMessage(msg, s){
	s.send(msg, function(){
		alert('分享到"'+s.description+'"成功！');
	}, function(e){
		alert(JSON.stringify(e))
//		alert('分享到"'+s.description+'"失败: '+JSON.stringify(e));
	});
}
		</script>
	</head>
	<body>
		<div class="app_head">
			<div class="app_prev" onclick="clicked('../index.html')"><img src="../img/arrow.png" /></div>
            <div class="app_head_text">我的信息</div>
            <div class="app_share" onclick="shareHref()"><img src="../img/share.png" /></div>
       </div>
        	<textarea style="display: none;" id="sharecontent" rows="3">分享内容</textarea>  <!--分享内容---->
        	<input style="display: none;" id="sharehref" class="sharehref" type="url" value="" >
			<input style="display: none;" id="sharehrefTitle" class="sharehref" type="text" value="超高性价比物流保障！" >   <!---标题--->
			<input style="display: none;" id="sharehrefDes" class="sharehref" type="text" value="将承接运单录入系统后缴纳一定的信息服务费，即可获赠等价值的物流责任险！" />    <!---描述--->
        <div class="app_body">
            <div class="main_in_input">
                <div class="main_in_input_text_left">姓名：</div>
                <div class="main_in_input_input_right"><input type="text" id="user_name" value="" readonly /></div>
            </div>
            <div class="main_in_input">
                <div class="main_in_input_text_left">手机号：</div>
                <div class="main_in_input_input_right"><input type="text" id="user_phone" value="" readonly /></div>
            </div>
            <div class="main_in_input">
                <div class="main_in_input_text_left">推荐码：</div>
                <div class="main_in_input_input_right" >
                	<div id="getcode" style="float: left;line-height: 100px;text-indent: 10px;margin-right: 80px;"></div>
                	<div id="qrcode" style="float: right;"></div>
                </div>
            </div>
            <div class="app_submit" onclick="clicked('../user/useredit.html')">修改密码</div>
        </div>
        <div style="padding-bottom: 80px;" class="app_body">
            <div class="main_in_api_head">其他工具</div>
            <div style="margin-top: 30px;background: #fff;height: 120px;font-size: 0.7em;">
                <div class="bg_submit" onclick="clicked('api_s1.html')">彩票开奖查询</div>
                <div class="bg_submit" onclick="clicked('api_s2.html')">全国车辆交通违章查询</div>
            </div>
            <div style="margin-top: 30px;background: #fff;height: 100px;font-size: 0.7em;">
                <div class="bg_submit" onclick="clicked('api_s3.html')">今日油价</div>
                <div class="bg_submit" onclick="clicked('./card_recharge.html')" >油卡充值申请</div>
            </div>
        </div>
        <div style="padding: 0 0 10px;" class="app_body">
            <div class="app_submit" onclick="exit()">退出登录</div>
        </div>
        
        <div class="outside_pull"></div>
        <img src="../img/loading.gif" class="fade_out_img" id="fade_out_loading" />
	</body>
</html>
